package th.retrofit.lib;

import java.util.Arrays;
import java.util.HashSet;
import java.util.Iterator;
import java.util.Set;

public class Test {

    public boolean contain(String[] s1, String[] s2) {
        Set<String> set1 = new HashSet<>(Arrays.asList(s1));
        Set<String> set2 = new HashSet<>(Arrays.asList(s2));
        if (set1.size() != set2.size()) return false;
        Iterator<String> iterator1 = set1.iterator();
        Iterator<String> iterator2 = set2.iterator();
        while (iterator1.hasNext()) {
            String sub1 = iterator1.next();
            String sub2 = iterator2.next();
            if (!sub1.equals(sub2)) {
                return false;
            }
        }
        return true;
    }

    public static void main(String[] args) {
        String[] s1 = new String[]{"a","b","c"};
        String[] s2 = new String[]{"c","d", "a","b"};
        System.out.println(new Test().contain(s1, s2));
    }

}
